import { CoolConfig, MODETYPE } from '@cool-midway/core';
import { MidwayConfig } from '@midwayjs/core';
import * as redisStore from 'cache-manager-ioredis';
// import * as fsStore from 'cache-manager-fs-hash';

export default {
  // use for cookie sign key, should change to your own and keep security
  keys: 'cool-admin for node',
  koa: {
    port: 8001,
  },
  // 模板渲染
  view: {
    mapping: {
      '.html': 'ejs',
    },
  },
  // 文件上传
  upload: {
    fileSize: '200mb',
    whitelist: null,
  },
  // 缓存 可切换成其他缓存如：redis http://midwayjs.org/docs/extensions/cache
  cache: {
    store: redisStore,
    options: {
      host: '122.51.25.62', // default value
      port: 6379, // default value
      password: 'Nianchu@.',
      db: 0,
      keyPrefix: 'doupiaopiao:cache:',
      ttl: 100,
      connectTimeout: 10000,
    },
  },
  bodyParser: {
    enable: true,
  },
  // cache: {
  //   store: fsStore,
  //   options: {
  //     path: 'cache',
  //     ttl: -1,
  //   },
  // },
  cool: {
    file: {
      // 上传模式 本地上传或云存储
      mode: MODETYPE.CLOUD,
      cos: {
        accessKeyId: 'AKIDrmhaRH3o',
        accessKeySecret: 'DNVaxvvtpnkg',
        bucket: 'qilinping',
        region: 'ap-beiji',
        publicDomain: '',
        durationSeconds: 7200,
      },
    },
  } as CoolConfig,
} as MidwayConfig;
